<template>
  <van-sticky>
    <van-nav-bar
      title="标题"
      left-text="返回"
      left-arrow
      @click-left="onClickLeft"
    />
  </van-sticky>
  <div>
    <div v-html="xqList.goods_introduce"></div>
    <van-action-bar>
      <van-action-bar-icon icon="chat-o" text="客服" color="#ee0a24" />
      <van-action-bar-icon icon="cart-o" text="购物车" to="/home/gou"/>
      <van-action-bar-icon icon="star" text="已收藏" color="#ff5000" />
      <van-action-bar-button type="warning" text="加入购物车" @click="jr"/>
      <van-action-bar-button type="danger" text="立即购买" />
    </van-action-bar>
  </div>
</template>

<script setup>
import axios from "axios";
import { ref } from "vue";
import { useRoute, useRouter } from "vue-router";
const router = useRouter();
const route = useRoute();
const onClickLeft = () => router.go(-1);
const xqList=ref([])
axios.get('https://api-hmugo-web.itheima.net/api/public/v1/goods/detail',{
    params:{
        goods_id:route.query.cid
    }
}).then(res=>{
    xqList.value=res.data.message
})
import { Cart } from "../store";
const {ADD_cart}=Cart()
const jr=()=>{
    ADD_cart({...xqList.value,count:1,check:true})
}
</script>

<style lang="scss" scoped>
</style>